<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: ViewModels::Helpers::Mapping::Collection
  
    &mdash; Documentation by YARD 0.8.3
  
</title>

  <link rel="stylesheet" href="../../../css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="../../../css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../../../';
  framesUrl = "../../../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../../../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../../../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../../../_index.html">Index (C)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../../../ViewModels.html" title="ViewModels (module)">ViewModels</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Helpers.html" title="ViewModels::Helpers (module)">Helpers</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Mapping.html" title="ViewModels::Helpers::Mapping (module)">Mapping</a></span></span>
     &raquo; 
    <span class="title">Collection</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../../../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../../../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../../../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: ViewModels::Helpers::Mapping::Collection
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ViewModels::Helpers::Mapping::Collection</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">lib/view_models/helpers/collection.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    
<p>The Collection view_model helper has the purpose of presenting presentable
collections.</p>
<ul><li>
<p>Render as list</p>
</li><li>
<p>Render as table</p>
</li><li>
<p>Render as collection</p>
</li><li>
<p>Render a pagination</p>
</li></ul>


  </div>
</div>
<div class="tags">
  

</div>






  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#collection-instance_method" title="#collection (instance method)">- (Object) <strong>collection</strong>(options = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Renders a collection.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (Collection) <strong>initialize</strong>(collection, context) </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>A new instance of Collection.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#list-instance_method" title="#list (instance method)">- (Object) <strong>list</strong>(options = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Renders a list (in the broadest sense of the word).</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#pagination-instance_method" title="#pagination (instance method)">- (Object) <strong>pagination</strong>(options = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Renders a pagination.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#table-instance_method" title="#table (instance method)">- (Object) <strong>table</strong>(options = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Renders a table.</p>
</div></span>
  
</li>

      
    </ul>
  

<div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="ViewModels::Helpers::Mapping::Collection (class)">Collection</a></span></tt>) <strong>initialize</strong>(collection, context) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>A new instance of Collection</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


37
38
39</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 37</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span>
  <span class='ivar'>@collection</span><span class='comma'>,</span> <span class='ivar'>@context</span> <span class='op'>=</span> <span class='id identifier rubyid_collection'>collection</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="collection-instance_method">
  
    - (<tt>Object</tt>) <strong>collection</strong>(options = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
  <div class="note notetag">
    <strong>Note:</strong>
    <div class='inline'>
<p>The only difference between a list and a collection is the enclosing list
type. While list uses ol, the collection uses ul.</p>
</div>
  </div>


<p>Renders a collection.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>The options for the collection</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>options</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:collection</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the collection to iterate over (default: The collection of the collection
view_model to iterate over)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:context</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the context to render in (default: The original context given to the
collection view_model to render in)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:template_name</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the template to render for each model element (default: Uses
:collection_item as the default element template)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:separator</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<h1 id="label-%3E+separator+between+each+element+%28default%3A+nil+separator+in+html%29">&gt; separator between each element (default: nil separator in html)</h1>
</div>
          
        </li>
      
    </ul>
  


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


63
64
65</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 63</span>

<span class='kw'>def</span> <span class='id identifier rubyid_collection'>collection</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>          
  <span class='id identifier rubyid_render_partial'>render_partial</span> <span class='symbol'>:collection</span><span class='comma'>,</span> <span class='id identifier rubyid_template_locals'>template_locals</span><span class='lparen'>(</span><span class='symbol'>:collection_item</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="list-instance_method">
  
    - (<tt>Object</tt>) <strong>list</strong>(options = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Renders a list (in the broadest sense of the word).</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>The options for the list</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>options</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:collection</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the collection to iterate over (default: The collection of the collection
view_model to iterate over)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:context</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>context to render in (default: The original context given to the collection
view_model to render in)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:template_name</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the template to render for each model element (default: list_item as the
default element template)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:separator</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the separator between each element (default: nil separator in html)</p>
</div>
          
        </li>
      
    </ul>
  


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


49
50
51</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 49</span>

<span class='kw'>def</span> <span class='id identifier rubyid_list'>list</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>          
  <span class='id identifier rubyid_render_partial'>render_partial</span> <span class='symbol'>:list</span><span class='comma'>,</span> <span class='id identifier rubyid_template_locals'>template_locals</span><span class='lparen'>(</span><span class='symbol'>:list_item</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="pagination-instance_method">
  
    - (<tt>Object</tt>) <strong>pagination</strong>(options = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Renders a pagination.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>The options for the collection</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>options</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:collection</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the collection to iterate over (default: The collection of the collection
view_model to iterate over)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:context</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the context to render in (default: The original context given to the
collection view_model to render in)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:template_name</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the template to render for each model element (default: Uses
:collection_item as the default element template)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:separator</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<h1 id="label-%3E+separator+between+each+element+%28default%3A+%7C+separator+in+html%29">&gt; separator between each element (default: | separator in html)</h1>
</div>
          
        </li>
      
    </ul>
  


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


89
90
91</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 89</span>

<span class='kw'>def</span> <span class='id identifier rubyid_pagination'>pagination</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>          
  <span class='id identifier rubyid_render_partial'>render_partial</span> <span class='symbol'>:pagination</span><span class='comma'>,</span> <span class='id identifier rubyid_template_locals'>template_locals</span><span class='lparen'>(</span><span class='symbol'>:pagination</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:separator</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>|</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="table-instance_method">
  
    - (<tt>Object</tt>) <strong>table</strong>(options = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Renders a table.</p>

<p>Note: Each item represents a table row.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>The options for the table</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>options</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:collection</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the collection to iterate over (default: The collection of the collection
view_model to iterate over)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:context</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the context to render in (default: The original context given to the
collection view_model to render in)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:template_name</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>the template to render for each model element (default: Uses :table_row as
the default element template)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:separator</span>
          <span class="type">(<tt>Object</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<h1 id="label-%3E+separator+between+each+element+%28default%3A+nil+separator+in+html%29">&gt; separator between each element (default: nil separator in html)</h1>
</div>
          
        </li>
      
    </ul>
  


</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


77
78
79</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 77</span>

<span class='kw'>def</span> <span class='id identifier rubyid_table'>table</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>          
  <span class='id identifier rubyid_render_partial'>render_partial</span> <span class='symbol'>:table</span><span class='comma'>,</span> <span class='id identifier rubyid_template_locals'>template_locals</span><span class='lparen'>(</span><span class='symbol'>:table_row</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Tue Oct 16 23:27:35 2012 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.3 (ruby-1.9.3).
</div>

  </body>
</html>